package dfbz.demo.homework03;

import java.util.ArrayList;
import java.util.List;

public class Test {

    public static void main(String[] args) {
        List<User> list = new ArrayList<>();
        for(int i=0;i<50;i++) {
            list.add(new User("", i+1));
        }

        for (int i=0;i<10;i++){
            new JieDaiYuan(new Filter() {
                @Override
                public void filterUser(User u) {
                }
            }).setUserType(list.get(10+i), "v1");
        }


        for (int i=0;i<10;i++) {
            new JieDaiYuan(new Filter() {
                @Override
                public void filterUser(User u) {
                }
            }).setUserType(list.get(20+i), "v2");
        }

        JieDaiYuan jieDaiYuan3 = new JieDaiYuan(new Filter() {
            @Override
            public void filterUser(User u) {
            }
        });

        System.out.println("未分组：");
        System.out.print("[");
        for (User user : list) {
            if (user.getUserType() == null || user.getUserType() == "") {
                System.out.print(user.getUserId() + "-" + null + ",");
            }
        }
        System.out.println("]");
        System.out.println("已分组：");
        int count = 0;
        for (User user : list) {
            if (count++ % 9 == 0) {
                System.out.println();
            }
            if (user.getUserType() == null || user.getUserType() == "") {
                System.out.print(user.getUserId() + "-A ");
            } else {
                System.out.print(user.getUserId() + "-" + user.getUserType() + " " );
            }
        }
    }
}
